package com.vanke.house.api.response;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.util.List;

/**
 * @author fangyu
 * @version v1.0.0
 * @date 2020/5/7 12:14 下午
 */
@Data
public class PageResult<T> {
    private long current;
    private long pageSize;
    private long pages;
    private long total;
    private List<T> records;

    public static <T> PageResult<T> restPage(IPage<T> page){
        PageResult<T> result = new PageResult<T>();
        result.setPages(page.getPages());
        result.setCurrent(page.getCurrent());
        result.setPageSize(page.getSize());
        result.setTotal(page.getTotal());
        result.setRecords(page.getRecords());
        return result;
    }
}
